home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGSCAL
/
TPAINT2.LZH
/
VUTPAINT.PAS
< prev
Wrap
Pascal/Delphi Source File
|
1986-03-15
|
4KB
|
116 lines
(* ******************************************************* *)
(* *)
(* VUTPAINT.PAS *)
(* *)
(* This is a program to view picture files created by *)
(* Turbo Paint (TPAINT.COM) with out any menu screen *)
(* or border. It also shows you how to call paint *)
(* pictures into your Turbo programs *)
(* *)
(* (c) March 1986 Donald L. Pavia *)
(* Department of Chemistry *)
(* Western Washington University *)
(* Bellingham, WA 98225 *)
(* *)
(* ******************************************************* *)
program ViewTPaint (input,output);
const ColBuffer = $B800; Offset = 0;
Blank = ' '; IOerr : boolean = false;
type
str14 = string[14];
ScreenType = array[0..16383] of byte;
ScreenPointer = ^ScreenType;
var ViewAnother : char;
PicName : str14;
i,col,pal : integer;
{------------------------------------------------}
procedure IOcheck (IOresult : integer; var IOerr : boolean);
begin
IOerr := (IOresult <> 0);
if IOerr then begin write (#7); write (Blank) end;
end;
{------------------------------------------------}
function Exist (FileName : Str14) : boolean;
var Fil : file;
begin
assign (Fil,FileName);
{$I-} reset (Fil); {$I+}
Exist := (IOresult = 0);
close (Fil);
end;
{------------------------------------------------}
procedure LoadScreen(FileName : str14);
type PicFile = file of ScreenType;
var Picture : ScreenPointer;
PictureFile : PicFile;
begin
Picture := ptr (ColBuffer,Offset);
assign (PictureFile,FileName);
reset (PictureFile);
read (PictureFile,picture^);
close (PictureFile);
end;
{------------------------------------------------}
begin
repeat
clrscr;
writeln; writeln;
write (' Enter FileName : ');
readln (PicName);
writeln;
write (' The Screen Mode is Medium Resolution ');
writeln; writeln;
write (' Choice of BackGroundColor (0..15) ? : ');
{$I-}
repeat
read (col); IOcheck (IOresult,IOerr);
until not IOerr;
writeln; writeln;
write (' Choice of Palette (0..3) ? : ');
repeat
read (pal); IOcheck (IOresult,IOerr);
until not IOerr;
{$I+}
writeln; writeln; writeln;
writeln (' Just Press <RETURN> to View Screen !!!!!! ');
writeln;
write (' Then Press <RETURN> a Second Time to Exit ');
readln;
GraphColorMode; GraphBackGround (col); Palette (pal);
if Exist (PicName) then
LoadScreen (PicName)
else
begin
gotoxy (5,12); write ('Sorry, That File Doesn''t Exist');
gotoxy (5,14); write (' Press <RETURN> to Continue ')
end;
readln;
TextMode (c80); clrscr;
writeln;
write (' View Another? Y/N ? ');
repeat
read (Kbd,ViewAnother);
until UpCase(ViewAnother) in ['Y','N'];
writeln;writeln;
until UpCase(ViewAnother) = 'N';
end.